cmake_minimum_required(VERSION 3.0)
project(ai9_logic_2017)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(CopyFile.cmake)

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -g -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
include_directories(src)
include_directories(src/include)
include_directories(src/thirdparty/jsoncpp)
add_definitions(-D${CMAKE_SYSTEM_NAME})

if(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv|nmake)")
    add_definitions(/W1)
endif()
IF(APPLE)
  SET(CMAKE_INSTALL_NAME_DIR @executable_path)
  SET(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
ENDIF(APPLE)

aux_source_directory(src SOURCE_FILES)

add_library(lib_ai9_logic_2017 OBJECT src/include/entity.h src/include/prefixobject.h src/include/skill.h src/entity.cpp src/Game.cpp src/include/Game/Game.h src/include/ActMaker/ActMaker.h src/Skills/base.cpp src/Skills/base.h src/skill.cpp src/include/entitymanager.h src/entitymanager.cpp src/include/sdk/point.h src/Entities/dummy.cpp src/Entities/dummy.h src/Entities/actor.cpp src/Entities/actor.h src/Skills/automatic.cpp src/Skills/automatic.h src/include/sdk/Commands.cpp src/thirdparty/jsoncpp/jsoncpp.cpp src/prefixobject.cpp src/Skills/typeAttack.cpp src/Skills/typeAttack.h src/Skills/typeDefense.cpp src/Skills/typeDefense.h src/Skills/typeGather.cpp src/Skills/typeGather.h src/Entities/plant.cpp src/Entities/plant.h src/Skills/typeEnergy.cpp src/Skills/typeEnergy.h src/Entities/linkmanager.h src/Skills/Linktime.h src/Entities/linkmanager.cpp src/include/Game/Terrain.h src/Terrain.cpp src/UI_Logic_Interface.cpp src/ActMaker.cpp src/LogicExecutor.cpp src/include/sdk/misc.h src/include/sdk/misc.cpp src/Skills/Level.cpp src/Skills/event.cpp src/Skills/event.h src/Skills/debugskill.cpp src/Skills/debugskill.h src/Skills/link.cpp src/Skills/link.h src/include/AbstractActMaker.h src/include/UI_Logic_Interface.h src/include/sdk/Commands.h src/UI_Logic_API.cpp src/include/UI_Logic_API.h src/Skills/StatCheck.cpp src/Skills/StatCheck.h src/include/sdk/sdk.cpp src/include/sdk/interpreter.cpp src/include/sdk/interpreter.h src/include/sdk/PPlayerInfo.cpp src/include/sdk/PPlayerInfo.h src/include/sdk/stats.cpp src/include/sdk/stats.h src/include/sdk/const.h src/include/sdk/PPlayerInfo.h)
add_library(lib_logic SHARED $<TARGET_OBJECTS:lib_ai9_logic_2017>)
add_subdirectory(test)
#add_executable(ai9_logic_2017 $<TARGET_OBJECTS:lib_ai9_logic_2017> src/main.cpp)
add_executable(api_test dlltest/main.c)
add_executable(doc_gen doc/doc_gen.cpp $<TARGET_OBJECTS:sdk>)
target_link_libraries(api_test lib_logic)
add_subdirectory(Ai)

if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
else()
    #target_link_libraries(ai9_logic_2017 dl pthread)
    target_link_libraries(api_test dl pthread)
endif()
